﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
    class Dbhelp
    {
        public static readonly string conString = "server=.;database=Blogs;uid=sa;pwd=123456";

        public static DataTable GetData(string sql)
        {


            SqlDataAdapter Datadapter = new SqlDataAdapter(sql, conString);
            DataTable sup = new DataTable();

            Datadapter.Fill(sup);
            return sup;
        }
        public static int AddorUpdateOrDelete(string sql)
        {
            SqlConnection connection = new SqlConnection(conString);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            return command.ExecuteNonQuery();
        }
    }
}
